import Vue from "vue"
import VueRouter from "vue-router"
import Home from "../views/Home.vue"
import Main from "../views/Main.vue"
//分区组件
import CategoryEdit from "../views/CategoryEdit.vue"
import CategoryList from "../views/CategoryList.vue"
//通知组件
import NoticeList from "../views/NoticeList.vue"
//用户组件
import UserEdit from "../views/UserEdit.vue"
import UserList from "../views/UserList.vue"
//消息组件
import MessageList from "../views/MessageList.vue"
//评论组件
import CommentList from "../views/CommentList.vue"
//视频组件
import VideoEdit from "../views/VideoEdit.vue"
import VideoList from "../views/VideoList.vue"
//直播组件
import LiveEdit from "../views/LiveEdit.vue"
import LiveList from "../views/LiveList.vue"

Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    name: "Main",
    component: Main,
    children: [
      // 分区子路由
      { path: "/categories/create", component: Home },
      { path: "/categories/list", component: CategoryList },

      //系统通知
      { path: "/notices/list", component: NoticeList },
      // 用户子路由
      {
        path: "/users/create",
        component: UserEdit,
      },
      { path: `/users/edit/:id`, component: UserEdit, props: true },
      { path: "/users/list", component: UserList },
      //消息子路由
      { path: "/messages/list", component: MessageList },
      //评论
      { path: "/comments/list", component: CommentList },

      //视频子路由
      {
        path: "/videos/create",
        component: VideoEdit,
      },
      { path: `/videos/edit/:id`, component: VideoEdit, props: true },
      { path: "/videos/list", component: VideoList },
      //直播子路由
      {
        path: "/live/create",
        component: LiveEdit,
      },
      { path: `/live/edit/:id`, component: LiveEdit, props: true },
      { path: "/live/list", component: LiveList },
    ],
  },
  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
]

const router = new VueRouter({
  routes,
})

export default router
